package com.zhangxun.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhangxun.domain.SysMenu;
import com.zhangxun.service.SysMenuService;
import com.zhangxun.mapper.SysMenuMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 张循
* @description 针对表【sys_menu(菜单管理)】的数据库操作Service实现
* @createDate 2022-12-29 15:29:14
*/
@Service
@CacheConfig(cacheNames = "com.zhangxun.service.impl.SysMenuServiceImpl")
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu>
    implements SysMenuService{

    @Autowired
    private SysMenuMapper sysMenuMapper;

    @Override
    public List<SysMenu> selectMenuByUserId(Long userId) {

      return sysMenuMapper.selectMenuByUserId(userId);
    }

    @Override
    @Cacheable(key = "'list'")
    public List<SysMenu> listWithRedis() {

       return  this.list();
    }
}




